<?php
$this->breadcrumbs=array(
	'Manage Templates'	
);

?>

<h1>Manage Email Templates</h1>

<p>
You may optionally enter a comparison operator (<b>&lt;</b>, <b>&lt;=</b>, <b>&gt;</b>, <b>&gt;=</b>, <b>&lt;&gt;</b>
or <b>=</b>) at the beginning of each of your search values to specify how the comparison should be done.
</p>



<?php $grid = $this->widget('zii.widgets.grid.CGridView', array(
	'id'=>'templates-grid',
	'dataProvider'=>$model->search(),
	'filter'=>$model,
    'selectableRows'=>2,
    'selectionChanged'=>"updateSelectors",
	'columns'=>array(
        array(
            'class'=>'CCheckBoxColumn',
            'value'=>'$data->id',
            'htmlOptions'=>array('width'=>'3%'),
        ),
	'id',
	'name',
	array(
	    'name'=>'subject',
	    'value'=>'$data->getFriendlySubject($data->subject)',
	),
	'class_path',		
	array(
		'class'=>'CButtonColumn',
		'template'=>'{update} {delete}',
		'updateButtonUrl'=>'url("/Admin/tools/updateTemplates",array("id"=>$data->id))'
	),
	),
)); 

if ($grid->dataProvider->ItemCount) {
    $data = array();
    if(Yii::app()->request->enableCsrfValidation)
    {
        $csrfTokenName = Yii::app()->request->csrfTokenName;
        $csrfToken = Yii::app()->request->csrfToken;
        $data[$csrfTokenName] = $csrfToken;
    }
    $this->menu[] = array('label' => 'Delete selected items', 'url'=>$this->createUrl('delete'), 'linkOptions' => array('onclick'=>'return multipleDelete("templates-grid",this.href, false, '.CJavaScript::encode($data).')'));
}
Yii::app()->clientScript->registerScriptFile(Yii::app()->core->AssetUrl.'/scripts/gridview.js', CClientScript::POS_BEGIN);
?>
